package com.wing.cabinet.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 领取记录表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_receive_record")
public class ReceiveRecord extends BaseEntity<ReceiveRecord> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum LineEvaluatePeriod implements IEnum<Integer> {

        /**
         * 每天
         */
        day(0,"每天"),
        /**
         * 每周
         */
        week(1,"每周"),
        /**
         * 每月
         */
        month(2,"每月"),
        /**
         * 每季度
         */
        quarter(3,"每季度"),
        /**
         * 每年
         */
        year(4,"每年");

        private int code;
        private String desc;

        LineEvaluatePeriod(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * sku code
     */
    private String skuCode;

    /**
     * 领取人Id
     */
    private Long receiverId;

    /**
     * 领取人
     */
    private String receiverName;

    /**
     * 领取金额
     */
    private BigDecimal receiverMoney;

    /**
     * 领取时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime receiverTime;

    /**
     * 领取数量
     */
    private Integer quantity;

    /**
     * 权限组Id
     */
    private Long authorityManageId;

    /**
     * 额度评估周期
     */
    private LineEvaluatePeriod lineEvaluatePeriod;

    /**
     * 额度评估周期描述
     */
    @TableField(exist = false)
    private String lineEvaluatePeriodDesc;

    public String getLineEvaluatePeriodDesc() {
        return lineEvaluatePeriod == null ? null : lineEvaluatePeriod.getDesc();
    }

    /**
     * 剩余可领金额
     */
    private BigDecimal balance;

}
